﻿using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria.UI;

namespace Terraria.GameContent.UI.Elements
{
	// Token: 0x020003EC RID: 1004
	public class UIImageFramed : UIElement
	{
		// Token: 0x06002389 RID: 9097 RVA: 0x00478A00 File Offset: 0x00476C00
		public UIImageFramed(Texture2D texture, Rectangle frame)
		{
			this._texture = texture;
			this._frame = frame;
			this.Width.Set((float)this._frame.Width, 0f);
			this.Height.Set((float)this._frame.Height, 0f);
		}

		// Token: 0x0600238A RID: 9098 RVA: 0x00478A64 File Offset: 0x00476C64
		public void SetImage(Texture2D texture, Rectangle frame)
		{
			this._texture = texture;
			this._frame = frame;
			this.Width.Set((float)this._frame.Width, 0f);
			this.Height.Set((float)this._frame.Height, 0f);
		}

		// Token: 0x0600238B RID: 9099 RVA: 0x00478AB8 File Offset: 0x00476CB8
		public void SetFrame(Rectangle frame)
		{
			this._frame = frame;
			this.Width.Set((float)this._frame.Width, 0f);
			this.Height.Set((float)this._frame.Height, 0f);
		}

		// Token: 0x0600238C RID: 9100 RVA: 0x00478B04 File Offset: 0x00476D04
		protected override void DrawSelf(SpriteBatch spriteBatch)
		{
			CalculatedStyle dimensions = base.GetDimensions();
			spriteBatch.Draw(this._texture, dimensions.Position(), new Rectangle?(this._frame), this.Color);
		}

		// Token: 0x04003FCA RID: 16330
		private Texture2D _texture;

		// Token: 0x04003FCB RID: 16331
		private Rectangle _frame;

		// Token: 0x04003FCC RID: 16332
		public Color Color = Color.White;
	}
}
